

<p><a target="_blank" href="/admin/{{$current_controller}}/list"><i class="fa fa-angle-double-left"></i> &nbsp; 返回数据列表</a></p>
<hr>


<div class="users form">
{{if $current_action=='admin_add'}}
<?php 
echo $this->MForm->create($current_model,array(
	'url' => array('action' => 'add'),
));
?>
{{elseif $current_action=='admin_edit'}}
 <?php 
echo $this->MForm->create($current_model,array(
	'class'=>'form-horizontal form',
    'url' => array('action' => 'edit',$id,$copy),
));
?>
{{/if}}
<fieldset>
    	 
            <ul class="nav nav-tabs">
                <li class="active"><a href="#article-main" data-toggle="tab"><span>{{__('Basic Info')}}</span></a></li>
                <li><a href="#article-publishing" data-toggle="tab"><span>{{__('Advanced Options')}}</span></a></li>
                {{$this->Layout->getLanguageTabHead($current_model)}}
            </ul>
            <div class="tab-content">
                <div id="article-main" class="tab-pane active">
                	 <?php
                	 	echo $this->MForm->input('id');
						if($current_action=='admin_add'){
				        	echo $this->MForm->input('name',array('size'=>'80','required'=>'required','onblur'=>"generateSlug(this,'#ArticleSlug')"));
						}
						else{
							echo $this->MForm->input('name',array('size'=>'80','required'=>'required'));
						}
				        echo $this->MForm->input('cate_id'); /*,'options'=>$categories */
						echo $this->MForm->swfupload('coverimg');
						echo $this->MForm->selectAssoc('Tag');
						echo $this->MForm->input('preview_url');
						echo $this->MForm->input('use_grade');
						echo $this->MForm->input('published',array('default'=>1));
						echo $this->MForm->input('summary',array('rows' => '4', 'cols' => '80')); 
						echo $this->MForm->input('rules',array('rows' => '14', 'cols' => '80')); 
					        
				     ?>
				     <div class="clearfix"></div>
				  <?php
					//echo $this->MForm->titleImage('Article.coverimg'); 
					
					echo $this->MForm->ckeditor('content',array('is_admin'=>true));
				  ?>
                </div>
                
                 
                 <div id="article-publishing"  class="tab-pane">
                 	<?php
                 	
				    echo $this->MForm->input('deleted');	
					echo $this->MForm->input('creator');
                   
                    //echo $this->MForm->input('promote', array('label' => __('Promoted to front page', true)));                   
                    echo $this->MForm->input('created');
                    echo $this->MForm->input('updated');
                	?>
                 </div> 
                 {{$this->Layout->getLanguageTabContent($current_model)}}          	
       </div>
 
    
    <div class="form-group">
    	<label class="col-sm-2 control-label"></label>
    	<div class="col-sm-10 controls"><?php echo $this->MForm->submit(__('Submit'),array('id'=>'btnsubmit')); ?></div>
    </div>
    </fieldset>
	{{$this->MForm->end()}}
</div>

<script>
	$(document).ready(function(){		 
		$('#btnsubmit').click(function(){		
			var oEditor = CKEDITOR.instances.ArticleContent;
			var content = oEditor.getData();
			$('#ArticleContent').val(content);
			if(typeof(before_submit)=="function"){
				if(before_submit()==false)
					return false;
			}
			try {
				var hasfile = false;
				for(var i=0;i<swfu_array.length;i++){
					var stats = swfu_array[i].getStats();
					if(stats && stats.files_queued ==0){
						continue;
					}
					else if(stats){
						hasfile = true;
						swfu_array[i].startUpload();
					}
				}
				if(!hasfile){
					// 无正在上传的文件 ,直接提交表单  
					return true;			
				}
				else{
					form_submit_flag_for_swfupload = true;
					form_submit_obj_for_swfupload = this.form; //传递表单对象 
					alert("有文件正在上传，请稍候...");
				}
			} catch (ex) {
		
			}
			return false;	
		});
	});
</script>
